﻿package mortal.game.view.common.tooltip.tooltips
{
    import Message.Game.*;
    import com.gengine.utils.*;
    import com.mui.containers.globalVariable.*;
    import com.mui.controls.*;
    import extend.language.*;
    import fl.data.*;
    import flash.display.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.tooltip.tooltips.base.*;
    import mortal.game.view.common.tooltip.tooltips.data.*;
    import mortal.game.view.copy.ChallengeCopy.view.*;
    import mortal.game.view.copy.escort.renderer.*;
    import mortal.game.view.copy.petBreak.*;

    public class ToolTipPetBreakCopyItem extends ToolTipScaleBg
    {
        private var _starSp:Sprite;
        private var _bodySp:Sprite;
        private var _starSpName:GTextFiled;
        private var _name:GTextFiled;
        private var _bossInfo:GTextFiled;
        private var _rewardList:GTileList;
        private var _hpTxt:GTextFiled;
        private var _starPointPanel:StarPointPanel;
        private var _sweepTxt:GTextFiled;

        public function ToolTipPetBreakCopyItem()
        {
            this.createChildren();
            return;
        }// end function

        override public function set data(param1) : void
        {
            var _loc_3:ToolTipPetBreakCopyItemData = null;
            var _loc_5:String = null;
            var _loc_2:* = ToolTipPetBreakCopyItemData(param1).petBreak.isBig == EPetBreakType._EBreakBigPass ? (ImagesConst.ToolTipBgCheng) : (ImagesConst.ToolTipBg);
            this.setBg(_loc_2);
            super.data = param1;
            this._width = 340;
            if (ToolTipPetBreakCopyItemData(param1).petBreak.isBig == EPetBreakType._EBreakBigPass)
            {
                this._height = 290;
                this.updateSize(_width, _height);
            }
            else
            {
                this._height = 265;
                this.updateSize(_width, _height);
            }
            _loc_3 = param1 as ToolTipPetBreakCopyItemData;
            var _loc_4:* = Cache.instance.copy.petBreakCopy.petBreakInfo.hp;
            _loc_5 = HTMLUtil.addColor(PetBreakCopyUtil.isPass(_loc_3.petBreak.floor, _loc_3.petBreak.pass) ? (Language.getString(20830)) : (Language.getString(20831)), GlobalStyle.colorLv);
            if (_loc_3.petBreak.isBig == 1)
            {
                this._bodySp.y = 75;
                this._starSp.addChild(this._sweepTxt);
                this._starSp.addChild(this._starPointPanel);
                this._starPointPanel.value = _loc_3.star;
                this._name.htmlText = _loc_3.petBreak.passIconName + _loc_5;
                this._starSpName.text = Language.getStringByParam(70341, _loc_3.petBreak.pass);
            }
            else
            {
                this._bodySp.y = 50;
                this._starSpName.text = "";
                this._name.htmlText = Language.getStringByParam(70342, _loc_3.petBreak.pass, _loc_3.petBreak.passIconName) + _loc_5;
                DisplayUtil.removeMe(this._sweepTxt);
                DisplayUtil.removeMe(this._starPointPanel);
            }
            this._bossInfo.htmlText = "  " + _loc_3.petBreak.descStr;
            this._rewardList.dataProvider = new DataProvider(PetBreakCopyUtil.getReward(_loc_3.petBreak));
            this._rewardList.drawNow();
            this._hpTxt.text = Language.getStringByParam(70334, "6/" + _loc_4);
            return;
        }// end function

        private function createChildren() : void
        {
            this._starSp = UIFactory.sprite(0, 0, contentContainer2D);
            this._bodySp = UIFactory.sprite(0, 50, contentContainer2D);
            this._name = UIFactory.gTextField("", 0, 10, 300, 40, contentContainer2D, GlobalStyle.textFormatBai.setSize(15).setBold(true).center());
            this._starSpName = UIFactory.gTextField("", 20, 45, 220, 40, this._starSp, GlobalStyle.textFormatHuang.setSize(15).setBold(true));
            this._sweepTxt = UIFactory.gTextField(Language.getString(70331), 170, 48, 80, 20, this._starSp, GlobalStyle.textFormatHuang2);
            this._starPointPanel = UIFactory.getUICompoment(StarPointPanel);
            this._starPointPanel.totalStar = 3;
            UIFactory.setObjAttri(this._starPointPanel, 80, 42, -1, -1, this._starSp);
            UIFactory.bg(0, 0, 330, 2, this._bodySp, ImagesConst.SplitLine);
            UIFactory.bg(0, 80, 330, 2, this._bodySp, ImagesConst.SplitLine);
            UIFactory.gTextField(Language.getString(70332), 20, 10, 220, 20, this._bodySp, GlobalStyle.textFormatAnHuan);
            UIFactory.gTextField(Language.getString(70333), 20, 90, 220, 20, this._bodySp, GlobalStyle.textFormatAnHuan);
            this._bossInfo = UIFactory.gTextField("", 20, 30, 220, 20, this._bodySp, GlobalStyle.textFormatlan);
            this._bossInfo.wordWrap = true;
            this._bossInfo.multiline = true;
            this._rewardList = UIFactory.tileList(73, 118, 195, 50, this._bodySp);
            this._rewardList.setStyle("cellRenderer", BgItemCellRenderer);
            this._rewardList.columnWidth = 45;
            this._rewardList.rowHeight = 50;
            this._rewardList.selectable = false;
            this._rewardList.direction = GBoxDirection.HORIZONTAL;
            this._hpTxt = UIFactory.gTextField("", 100, 170, 160, 20, this._bodySp);
            return;
        }// end function

    }
}
